var uName = document.getElementById("userName");
let oinput = document.querySelectorAll("input");
//对用户名输入框进行验证
function fn() {
    var tishi1 = document.querySelector(".tishi1");
    var eorr1 = document.querySelector(".eorr1");
    var utest = /^[a-zA-Z]{1,4}\d{5,20}/g;
    var uResult = uName.value;
    if (utest.test(uResult)) {
        eorr1.style.display = "none";
        tishi1.style.display = "block";
    } else {
        eorr1.style.display = "block";
        tishi1.style.display = "none";
    }
}
//对输入框密码和确认密码进行对比验证
var tishi2 = document.querySelector(".tishi2");
var eorr2 = document.querySelector(".eorr2");
let pnum = document.getElementById("pnumber");
let rePnum = document.getElementById("rePnumber");
var tishi3 = document.querySelector(".tishi3");
var eorr3 = document.querySelector(".eorr3");

function ptext() {
    var ptest = /^[0-9]{6,9}/;
    let pValue = pnum.value;
    var rePvalue = rePnum.value;

    if (ptest.test(pValue)) {
        eorr2.style.display = "none";
        tishi2.style.display = "block";
    } else {
        eorr2.style.display = "block";
        tishi2.style.display = "none";
    }
    if (pValue == rePvalue) {
        eorr3.style.display = "none";
        tishi3.style.display = "block";
    } else {
        eorr3.style.display = "block";
        tishi3.style.display = "none";
    }
}

for (var i = 0; i < oinput.length; i++) {
    oinput[i].onblur = function() {
        fn();
        ptext();
    }
}
uName.onfocus = function() {
    eorr1.style.display = "none";
    tishi1.style.display = "block";
}
pnum.onfocus = function() {
    eorr2.style.display = "none";
    tishi2.style.display = "block";
}
rePnum.onfocus = function() {
    eorr3.style.display = "none";
    tishi3.style.display = "block";
}